/**
 * Copyright (c) 2009-2011, chunquedong(YangJiandong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 
 * History:
 *     2010-05-05  Jed Young  Creation
 */
package chunmap.model.relate.relateop;

import chunmap.model.geom.Geometry;
import chunmap.model.geom.GeometryCollection;
import chunmap.model.relate.ComputeIm;
import chunmap.model.relate.ComputeImFactory;
import chunmap.model.relate.IntersectionMatrix;

/**
 * 7RelationType
 * 
 * @author chunquedong
 * 
 */
public class Multi2Multi extends ComputeIm {

	public Multi2Multi(GeometryCollection m1, GeometryCollection m2) {
		g1 = m1;
		g2 = m2;
	}

	@Override
	protected void computeIM() {
		GeometryCollection c1 = (GeometryCollection) g1;
		GeometryCollection c2 = (GeometryCollection) g2;
		for (Geometry ge1 : c1) {
			for (Geometry ge2 : c2) {
				IntersectionMatrix tim = ComputeImFactory.getInstance()
						.getImComputer(ge1, ge2).getIM();
				im.unite(tim);
			}
		}
	}

	@Override
	protected int inner2innerDim(Geometry g1, Geometry g2) {
		return 0;
	}

	@Override
	protected boolean within(Geometry g1, Geometry g2) {
		return false;
	}

}